package com.zy.openchat.core.model.file;

import android.os.Parcel;
import android.os.Parcelable;

public class FileInfoRemote implements Parcelable {
    public String id;
    public String unique_id;
    public boolean is_uploading_active;
    public boolean is_uploading_completed;
    public long uploaded_size;

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.id);
        dest.writeString(this.unique_id);
        dest.writeByte(this.is_uploading_active ? (byte) 1 : (byte) 0);
        dest.writeByte(this.is_uploading_completed ? (byte) 1 : (byte) 0);
        dest.writeLong(this.uploaded_size);
    }

    public FileInfoRemote() {
    }

    protected FileInfoRemote(Parcel in) {
        this.id = in.readString();
        this.unique_id = in.readString();
        this.is_uploading_active = in.readByte() != 0;
        this.is_uploading_completed = in.readByte() != 0;
        this.uploaded_size = in.readLong();
    }

    public static final Creator<FileInfoRemote> CREATOR = new Creator<FileInfoRemote>() {
        @Override
        public FileInfoRemote createFromParcel(Parcel source) {
            return new FileInfoRemote(source);
        }

        @Override
        public FileInfoRemote[] newArray(int size) {
            return new FileInfoRemote[size];
        }
    };
}
